package com.youxin.cpcenter.common;


import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;

import com.youxin.busfoundation.bean.ResponseObject;
import com.youxin.foundation.lang.BaseException;

@ControllerAdvice
public class RestResponseEntityExceptionHandler extends ResponseEntityExceptionHandler {
	 
    @ExceptionHandler(value = { IllegalArgumentException.class, IllegalStateException.class ,BaseException.class,RuntimeException.class})
    protected ResponseEntity<Object> handleConflict(RuntimeException ex, WebRequest request) {

    	return new ResponseEntity<Object>(ResponseObject.systemError(ex), HttpStatus.OK);
        
    }
}